//
//  BaseTableViewController.swift
//  sina weibo
//
//  Created by 万美琳 on 15/12/15.
//  Copyright © 2015年 Eleven. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {

var userLogin = false
    
    var visitorLoginView : VisitorLoginView?
    
    //苹果专门为手码开发准备的 一旦实现了该方法  xib/ sb 自动失效
    //如果检测到view(根视图)为 nil  会自动调用 loadView
    override func loadView() {
        if userLogin {
        //注意调用super方法，来加载tableview。否则不显示
        super.loadView()
        }else{
        setVisitorLoginView()
        }
        
    }
    
    func setVisitorLoginView(){
    
//        let visitor = VisitorLoginView()
//        view = visitor
        visitorLoginView = VisitorLoginView()
        view = visitorLoginView
     }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        //viewDidLoad 调用只是设置层次结构，还没有设置frame
//        loadView ->viewDidLoad(设置view的层次结构) ->viewWillAppear ->viewDidLayoutSubviews(设置view的frame) ->viewDidAppear（显示视图）
      //view.bounds(0.0, 0.0, 0.0, 0.0)
//        view.frame =  CGRectMake(0, 0, 300, 500)
//        print(view.bounds)
        
        
        
        
        
    }
    
   
    
    override func viewDidLayoutSubviews() {
        
        //(0.0, 0.0, 375.0, 667.0)
//        print(view.bounds)

    }
//测试
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        
    }
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    
}
